package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.common.RedisConstant;
import com.itheima.health.entity.PageResult;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetMealService;
import com.itheima.health.util.QiniuUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.UUID;

/**
 * @author 程达
 * @description 手机端 套餐控制器
 * @date 2019/9/26
 **/
@RestController
@RequestMapping("/mobile/setmeal")
@Slf4j
public class MobileSetMealController {

    @Autowired
    private SetMealService setMealService;

    //5.根据接口文档定义接口,传入id，返回套餐详情对象数据
    @GetMapping("/findById")
    public Result findById(Integer id) {
        Setmeal setmeal = setMealService.findById(id);//
        return new Result(true, MessageConst.QUERY_SETMEAL_SUCCESS, setmeal);
    }

    /**
     * 任务7 全部套餐查询
     * @return
     */
    @GetMapping("/getSetmeal")
    public Result getSetmeal(){
        //调用rpc查询数据
        List<Setmeal> Setmeals = setMealService.findAll();
        return new Result(true, MessageConst.QUERY_CHECKGROUP_SUCCESS, Setmeals);
    }

//    /**
//     * 分页查询
//     *
//     * @return
//     */
//    @GetMapping("/findPage")
//
//    public Result findPage(QueryPageBean queryPageBean) {
//        //调用DAO层查询并返回
//        PageResult pageResult = setMealService.findPage(queryPageBean);
//        //构造返回结果并返回
//        return new Result(true, MessageConst.QUERY_SETMEAL_SUCCESS, pageResult);
//    }


}
